﻿using Report_IService.Web;
using Report_Service.Web;
using Report_Unity.Basic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace ReportWebApi.Controllers.Api.WeiXin
{
    [RoutePrefix("api/Company")]
    public class CompanyController : BaseApiController
    {
        private IT_CompanyService T_CompanyService = new T_CompanyService();

        [HttpPost,Route("AddCompany")]
        public ResultInfo AddCompany()
        {
            var req = HttpContext.Current.Request;
            string hid = req.Form["hid"];
            string name = req.Form["name"];
            string desc = req.Form["desc"];
            string userid = req.Form["userid"];

            ResultInfo res = T_CompanyService.AddCompany(hid,name,desc,userid);
            return res;
        }

        [HttpPost, Route("EditCompany")]
        public ResultInfo EditCompany()
        {
            var req = HttpContext.Current.Request;
            string cid = req.Form["cid"];
            string hid = req.Form["hid"];
            string name = req.Form["name"];
            string desc = req.Form["desc"];
            string userid = req.Form["userid"];

            ResultInfo res = T_CompanyService.EditCompany(cid,hid,name,desc,userid);
            return res;
        }

        [HttpPost, Route("DelCompany")]
        public ResultInfo DelCompany()
        {
            var req = HttpContext.Current.Request;
            string cid = req.Form["cid"];
            string hid = req.Form["hid"];

            ResultInfo res = T_CompanyService.DelCompany(cid,hid);
            return res;
        }

        [HttpGet, Route("GetListCompany")]
        public ResultInfo GetListCompany(string hid)
        {
            ResultInfo res = T_CompanyService.GetListCompany(hid);
            return res;
        }

    }
}
